<?php
/**
 * App for managing companies
 * 
 * Template for company searching
 * 
 * @category Abovo
 * 
 * @package Abovo_App_Crm
 * 
 * @subpackage Abovo_App_Crm_Companies
 * 
 * @license http://opensource.org/licenses/gpl-license.php GPL
 * 
 * @author Antti Holvikari <anttih@gmail.com>
 */
?>
<h2><?php echo $this->getText('APP_NAME') ?></h2>

<form action="<?php echo $this->action('buy/suppliers/browse') ?>" method="GET">
    <?php echo $this->formText(array(
        'name' => 'keywords',
    )) ?>
    
    <?php echo $this->formSubmit(array(
        'name'  => 'process',
        'value' => $this->getText('PROCESS_SEARCH'),
    )) ?>
    
</form>

<?php if (count($this->suppliers) > 0): ?>
<p><?php echo sprintf($this->getText('TEXT_RESULTS'), count($this->suppliers)) ?></p>
<table class="list">
    <tr>
        <th><?php echo $this->getTextClass('Abovo_Model_Company', 'LABEL_NAME') ?></th>
        <th><?php echo $this->getTextClass('Abovo_Model_Company', 'LABEL_VAT') ?></th>
        <th><?php echo $this->getTextClass('Abovo_Model_Company', 'LABEL_CITY') ?></th>
        <th><?php echo $this->getTextClass('Abovo_Model_Company', 'LABEL_DESCR') ?></th>
    </tr>
    <?php foreach ($this->suppliers as $customer): ?>
        <tr>
            <td><a href="<?php echo $this->action('buy/suppliers/show/' . $customer->id) ?>">
                <?php echo $customer->name ?></a>
            </td>
            <td><span class="tag"><?php echo implode('</span>, <span class="tag">', (array) $customer->tags) ?></span> 
            <?php echo $this->escape($customer->vat) ?></td>
            <td><?php echo $this->escape($customer->city) ?></td>
            <td><?php echo $this->escape(substr($customer->descr, 0, 50)) ?></td>
        </tr>
    <?php endforeach; ?>
</table>
<?php else: ?>

<?php endif; ?>